#
# Makefile for TSAR
#
# Henri DOREAU
# 
# Started on : jeudi 27 novembre 2008, 09:15:51 (UTC+0100)
# Last Modification : Fri Jan  2 22:56:39 CET 2009
#
# Written using Epitech's wiki available here : http://www.epitech-lyon.fr/wiki/index.php5?title=Makefile
#
# $Id: $
#

# Project name
NAME		=	tsar


# Source files
SRCS		=	main.c      		\
				options.c   		\
                utils.c     		\
                tsar.c      		\
				output.c  			\
				sniffer.c			\
                webserver.c         \
                sockpool.c          \
                parser.c            \
		        http_server.c		\
				gen_html_report.c	\


# Flags for compiler and linker
CFLAGS		+=
LDFLAGS		+=

# Include dir
INCLUDES	+=
# Libraries directory
LIBSDIR		+=
# Libraries to link
LIBS		+=


###############################################################
# Required commands
CC			=	gcc
RM			=	rm -f

# Object files
OBJS		=	$(SRCS:.c=.o)

# remove # and -libpcap to compile on a system where libpcap is not present
INCLUDES	+=	-I./includes -I/usr/include -I/usr/local/include -I./nopcap
LIBFOLDERS	+=	-L/usr/lib
LIBS		+=	-lm nopcap/libpcap.a

#INCLUDES	+=	-I./includes -I/usr/include -I/usr/local/include
#LIIBFOLDERS	+=	-L/usr/lib
#LIBS		+=	-lm -lpcap

STATIC		=	
CFLAGS		+=	-Wall -pedantic -g -pipe $(INCLUDES) -D_GNU_SOURCE -DIPV4_ONLY -D_FORTIFY_SOURCE=2
LDFLAGS		+=	$(LIBFOLDERS) $(LIBS) $(STATIC)





$(NAME): $(OBJS)
	$(CC) -o $(NAME) $(OBJS) $(LDFLAGS)

all: $(NAME)

.c.o:
	$(CC) $(CFLAGS) -c  $< -o $@

# User can choose to statically link the executable typing make static
static:
	$(MAKE) STATIC=-static

clean:
	$(RM) $(OBJS)

distclean: clean
	$(RM) $(NAME)

rebuild: distclean all

.PHONY: clean distclean rebuild static

